Load all required libraries.
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.6 v dplyr 1.0.8
## v tidyr 1.2.0 v stringr 1.4.0
## v readr 2.1.2 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(broom)
Read in raw data from RDS.
raw_data <- readRDS("./n1_n2_cleaned_cases.rds")
Make a few small modifications to names and data for visualizations.
final_data <- raw_data %>% mutate(log_copy_per_L = log10(mean_copy_num_L)) %>%
rename(Facility = wrf) %>%
mutate(Facility = recode(Facility,
"NO" = "WRF A",
"MI" = "WRF B",
"CC" = "WRF C"))
Seperate the data by gene target to ease layering in the final plot
#make three data layers
only_positives <<- subset(final_data, (!is.na(final_data$Facility)))
only_n1 <- subset(only_positives, target == "N1")
only_n2 <- subset(only_positives, target == "N2")
only_background <<-final_data %>%
select(c(date, cases_cum_clarke, new_cases_clarke, X7_day_ave_clarke)) %>%
group_by(date) %>% summarise_if(is.numeric, mean)
#specify fun colors
background_color <- "#7570B3"
seven_day_ave_color <- "#E6AB02"
marker_colors <- c("N1" = '#1B9E77',"N2" ='#D95F02')
#remove facilty C for now
#only_n1 <- only_n1[!(only_n1$Facility == "WRF C"),]
#only_n2 <- only_n2[!(only_n2$Facility == "WRF C"),]
only_n1 <- only_n1[!(only_n1$Facility == "WRF A" & only_n1$date == "2020-11-02"), ]
only_n2 <- only_n2[!(only_n2$Facility == "WRF A" & only_n2$date == "2020-11-02"), ]
Build the main plot
#first layer is the background epidemic curve
p1 <- only_background %>%
plotly::plot_ly() %>%
plotly::add_trace(x = ~date, y = ~new_cases_clarke,
type = "bar",
hoverinfo = "text",
text = ~paste('</br> Date: ', date,
'</br> Daily Cases: ', new_cases_clarke),
alpha = 0.5,
name = "Daily Reported Cases",
color = background_color,
colors = background_color,
showlegend = FALSE) %>%
layout(yaxis = list(title = "Clarke County Daily Cases", showline=TRUE)) %>%
layout(legend = list(orientation = "h", x = 0.2, y = -0.3))
#renders the main plot layer two as seven day moving average
p1 <- p1 %>% plotly::add_trace(x = ~date, y = ~X7_day_ave_clarke,
type = "scatter",
mode = "lines",
hoverinfo = "text",
text = ~paste('</br> Date: ', date,
'</br> Seven-Day Moving Average: ', X7_day_ave_clarke),
name = "Seven Day Moving Average Athens",
line = list(color = seven_day_ave_color),
showlegend = FALSE)
#renders the main plot layer three as positive target hits
p2 <- plotly::plot_ly() %>%
plotly::add_trace(x = ~date, y = ~mean_copy_num_L,
type = "scatter",
mode = "markers",
hoverinfo = "text",
text = ~paste('</br> Date: ', date,
'</br> Facility: ', Facility,
'</br> Target: ', target,
'</br> Copies/L: ', round(mean_copy_num_L, digits = 2)),
data = only_n1,
symbol = ~Facility,
marker = list(color = '#1B9E77', size = 8, opacity = 0.65),
showlegend = FALSE) %>%
plotly::add_trace(x = ~date, y = ~mean_copy_num_L,
type = "scatter",
mode = "markers",
hoverinfo = "text",
text = ~paste('</br> Date: ', date,
'</br> Facility: ', Facility,
'</br> Target: ', target,
'</br> Copies/L: ', round(mean_copy_num_L, digits = 2)),
data = only_n2,
symbol = ~Facility,
marker = list(color = '#D95F02', size = 8, opacity = 0.65),
showlegend = FALSE) %>%
layout(yaxis = list(title = "SARS CoV-2 Copies/L",
showline = TRUE,
type = "log",
dtick = 1,
automargin = TRUE)) %>%
layout(legend = list(orientation = "h", x = 0.2, y = -0.3))
#adds the limit of detection dashed line
p2 <- p2 %>% plotly::add_segments(x = as.Date("2020-03-14"),
xend = ~max(date + 10),
y = 3571.429, yend = 3571.429,
opacity = 0.35,
line = list(color = "black", dash = "dash")) %>%
layout(annotations = list(x = as.Date("2020-03-28"), y = 3.8, xref = "x", yref = "y",
text = "Limit of Detection", showarrow = FALSE))
p1
p2
Combine the two main plot pieces as a subplot
#seperate n1 and n2 frames by site
#n1
wrf_a_only_n1 <- subset(only_n1, Facility == "WRF A")
wrf_b_only_n1 <- subset(only_n1, Facility == "WRF B")
wrf_c_only_n1 <- subset(only_n1, Facility == "WRF C")
#n2
wrf_a_only_n2 <- subset(only_n2, Facility == "WRF A")
wrf_b_only_n2 <- subset(only_n2, Facility == "WRF B")
wrf_c_only_n2 <- subset(only_n2, Facility == "WRF C")
#rejoin the old data frames then seperate in to averages for each plant.
wrfa_both <- full_join(wrf_a_only_n1, wrf_a_only_n2)%>%
select(c(date, mean_total_copies)) %>%
group_by(date) %>%
summarize_if(is.numeric, mean) %>%
ungroup() %>%
mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
wrfb_both <- full_join(wrf_b_only_n1, wrf_b_only_n2)%>%
select(c(date, mean_total_copies)) %>%
group_by(date) %>%
summarize_if(is.numeric, mean) %>%
ungroup() %>%
mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
wrfc_both <- full_join(wrf_c_only_n1, wrf_c_only_n2)%>%
select(c(date, mean_total_copies)) %>%
group_by(date) %>%
summarize_if(is.numeric, mean) %>%
ungroup() %>%
mutate(log_total_copies_both = log10(mean_total_copies))
## Joining, by = c("date", "new_cases_clarke", "cases_cum_clarke",
## "X7_day_ave_clarke", "Facility", "collection_num", "target",
## "mean_copy_num_uL_rxn", "mean_copy_num_L", "sd_L", "se_L", "mean_total_copies",
## "sd_total_copies", "lo_95", "up_95", "log_copy_per_L")
#get max date
maxdate <- max(wrfa_both$date)
mindate <- min(wrfa_both$date)
Build loess smoothing figures figures
This makes the individual plots
#**************************************WRF A PLOT**********************************************
#add trendlines
#extract data from geom_smooth
#both extract
# *********************************span 0.6***********************************
#*****************Must always update the n = TOTAL NUMBER OF DAYS*************************
extract_botha <- ggplot(wrfa_both, aes(x = date, y = log_total_copies_both)) +
stat_smooth(aes(outfit=fit_botha<<-..y..), method = "loess", color = '#1B9E77',
span = 0.25, n = 821)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_botha
## `geom_smooth()` using formula 'y ~ x'
fit_botha
## [1] 13.05389 13.04901 13.04420 13.03944 13.03473 13.03008 13.02549 13.02095
## [9] 13.01646 13.01203 13.00765 13.00332 12.99904 12.99481 12.99063 12.98650
## [17] 12.98242 12.97839 12.97440 12.97046 12.96657 12.96272 12.95892 12.95517
## [25] 12.95145 12.94778 12.94416 12.94057 12.93703 12.93352 12.93006 12.92664
## [33] 12.92326 12.91991 12.91660 12.91334 12.91010 12.90691 12.90374 12.90062
## [41] 12.89753 12.89447 12.89144 12.88846 12.88551 12.88262 12.87977 12.87697
## [49] 12.87422 12.87151 12.86886 12.86626 12.86371 12.86121 12.85877 12.85639
## [57] 12.85405 12.85178 12.84956 12.84740 12.84530 12.84326 12.84128 12.83937
## [65] 12.83751 12.83572 12.83400 12.83234 12.83074 12.82922 12.82776 12.82637
## [73] 12.82505 12.82381 12.82263 12.82153 12.82050 12.81954 12.81866 12.81786
## [81] 12.81713 12.81648 12.81591 12.81542 12.81501 12.81467 12.81437 12.81413
## [89] 12.81394 12.81379 12.81370 12.81366 12.81368 12.81374 12.81386 12.81403
## [97] 12.81425 12.81453 12.81486 12.81524 12.81568 12.81617 12.81672 12.81732
## [105] 12.81798 12.81869 12.81946 12.82028 12.82116 12.82210 12.82309 12.82414
## [113] 12.82525 12.82641 12.82763 12.82892 12.83026 12.83165 12.83311 12.83463
## [121] 12.83620 12.83784 12.83954 12.84129 12.84311 12.84499 12.84693 12.84893
## [129] 12.85099 12.85312 12.85531 12.85756 12.85987 12.86305 12.86780 12.87395
## [137] 12.88136 12.88985 12.89928 12.90948 12.92028 12.93154 12.94309 12.95478
## [145] 12.96644 12.97792 12.98905 12.99968 13.00964 13.01879 13.02695 13.03397
## [153] 13.03969 13.04395 13.04827 13.05417 13.06153 13.07020 13.08007 13.09099
## [161] 13.10284 13.11548 13.12878 13.14260 13.15682 13.17131 13.18592 13.20054
## [169] 13.21501 13.22923 13.24304 13.25632 13.26894 13.28077 13.29166 13.30150
## [177] 13.31014 13.31746 13.32332 13.32759 13.33014 13.33084 13.33042 13.32973
## [185] 13.32874 13.32747 13.32588 13.32399 13.32177 13.31923 13.31636 13.31314
## [193] 13.30957 13.30565 13.30136 13.29670 13.29166 13.28623 13.28040 13.27417
## [201] 13.26754 13.26048 13.25300 13.24508 13.23672 13.22791 13.21865 13.20892
## [209] 13.19873 13.18805 13.17569 13.16062 13.14308 13.12329 13.10149 13.07791
## [217] 13.05280 13.02637 12.99888 12.97054 12.94161 12.91230 12.88286 12.85352
## [225] 12.82451 12.79606 12.76843 12.74182 12.71649 12.69266 12.67058 12.65046
## [233] 12.63256 12.61490 12.59548 12.57450 12.55215 12.52861 12.50407 12.47873
## [241] 12.45277 12.42637 12.39974 12.37305 12.34650 12.32027 12.29456 12.26956
## [249] 12.24544 12.22241 12.20065 12.18035 12.16169 12.14488 12.12959 12.11534
## [257] 12.10207 12.08971 12.07818 12.06743 12.05738 12.04796 12.03910 12.03074
## [265] 12.02280 12.01522 12.00793 12.00087 11.99395 11.98712 11.98030 11.97343
## [273] 11.96643 11.95924 11.95180 11.94402 11.93585 11.92721 11.91803 11.90825
## [281] 11.89871 11.89023 11.88270 11.87603 11.87010 11.86483 11.86009 11.85580
## [289] 11.85186 11.84814 11.84457 11.84103 11.83742 11.83363 11.82958 11.82514
## [297] 11.82023 11.81473 11.80856 11.80159 11.79374 11.78480 11.77471 11.76360
## [305] 11.75160 11.73883 11.72542 11.71149 11.69717 11.68258 11.66785 11.65310
## [313] 11.63847 11.62407 11.61003 11.59647 11.58352 11.57131 11.55996 11.54960
## [321] 11.54035 11.53234 11.52569 11.52053 11.51509 11.50768 11.49856 11.48798
## [329] 11.47616 11.46338 11.44986 11.43586 11.42162 11.40739 11.39341 11.37994
## [337] 11.36722 11.35549 11.34500 11.33600 11.32873 11.32345 11.32039 11.31981
## [345] 11.32194 11.32628 11.33207 11.33925 11.34774 11.35746 11.36832 11.38025
## [353] 11.39318 11.40703 11.42171 11.43714 11.45326 11.46998 11.48723 11.50492
## [361] 11.52298 11.54133 11.55989 11.57858 11.59733 11.61605 11.63468 11.65312
## [369] 11.67131 11.68916 11.70660 11.72354 11.74232 11.76506 11.79137 11.82085
## [377] 11.85311 11.88777 11.92441 11.96266 12.00213 12.04241 12.08312 12.12386
## [385] 12.16425 12.20389 12.24238 12.27934 12.31437 12.34708 12.37708 12.40397
## [393] 12.42737 12.44688 12.46483 12.48373 12.50347 12.52394 12.54501 12.56656
## [401] 12.58849 12.61066 12.63298 12.65530 12.67753 12.69954 12.72122 12.74245
## [409] 12.76310 12.78307 12.80224 12.82048 12.83769 12.85374 12.86851 12.88190
## [417] 12.89378 12.90403 12.91254 12.91919 12.92366 12.92583 12.92589 12.92403
## [425] 12.92046 12.91535 12.90890 12.90132 12.89278 12.88348 12.87361 12.86337
## [433] 12.85296 12.84255 12.83235 12.82254 12.81333 12.80490 12.79745 12.79116
## [441] 12.78624 12.78082 12.77308 12.76321 12.75143 12.73795 12.72299 12.70676
## [449] 12.68946 12.67131 12.65252 12.63330 12.61387 12.59443 12.57520 12.55639
## [457] 12.53821 12.52087 12.50459 12.48957 12.47602 12.46417 12.45421 12.44637
## [465] 12.43860 12.42889 12.41746 12.40454 12.39035 12.37511 12.35906 12.34241
## [473] 12.32539 12.30823 12.29116 12.27439 12.25815 12.24267 12.22818 12.21489
## [481] 12.20303 12.19284 12.18452 12.17832 12.17445 12.17245 12.17164 12.17196
## [489] 12.17332 12.17565 12.17887 12.18291 12.18768 12.19312 12.19914 12.20568
## [497] 12.21265 12.21997 12.22757 12.23538 12.24332 12.25131 12.25927 12.26713
## [505] 12.27481 12.28223 12.28933 12.29602 12.30222 12.30786 12.31287 12.31905
## [513] 12.32807 12.33967 12.35356 12.36944 12.38706 12.40611 12.42633 12.44742
## [521] 12.46912 12.49113 12.51317 12.53497 12.55625 12.57671 12.59608 12.61408
## [529] 12.63043 12.64484 12.65704 12.66674 12.67365 12.67751 12.67967 12.68165
## [537] 12.68344 12.68504 12.68644 12.68761 12.68855 12.68926 12.68970 12.68988
## [545] 12.68978 12.68940 12.68871 12.68770 12.68638 12.68471 12.68270 12.68033
## [553] 12.67758 12.67445 12.67093 12.66700 12.66265 12.65786 12.65264 12.64696
## [561] 12.64082 12.63420 12.62708 12.61947 12.61134 12.60269 12.59351 12.58246
## [569] 12.56845 12.55177 12.53273 12.51162 12.48875 12.46443 12.43894 12.41259
## [577] 12.38570 12.35854 12.33144 12.30468 12.27857 12.25342 12.22952 12.20718
## [585] 12.18669 12.16836 12.15249 12.13939 12.12639 12.11081 12.09293 12.07303
## [593] 12.05137 12.02822 12.00386 11.97856 11.95259 11.92622 11.89972 11.87337
## [601] 11.84744 11.82219 11.79791 11.77486 11.75332 11.73355 11.71583 11.70044
## [609] 11.68763 11.67769 11.66940 11.66137 11.65362 11.64619 11.63908 11.63232
## [617] 11.62594 11.61995 11.61438 11.60925 11.60458 11.60039 11.59671 11.59355
## [625] 11.59094 11.58890 11.58745 11.58662 11.58642 11.58688 11.58803 11.58987
## [633] 11.59327 11.59897 11.60680 11.61661 11.62824 11.64153 11.65632 11.67246
## [641] 11.68977 11.70811 11.72732 11.74723 11.76769 11.78854 11.80962 11.83077
## [649] 11.85183 11.87265 11.89306 11.91290 11.93202 11.95026 11.96746 11.98345
## [657] 11.99809 12.01121 12.02423 12.03859 12.05417 12.07084 12.08846 12.10690
## [665] 12.12604 12.14575 12.16589 12.18635 12.20697 12.22765 12.24824 12.26863
## [673] 12.28867 12.30824 12.32721 12.34544 12.36282 12.37921 12.39448 12.40850
## [681] 12.42115 12.43306 12.44497 12.45685 12.46870 12.48049 12.49222 12.50386
## [689] 12.51540 12.52682 12.53811 12.54925 12.56022 12.57101 12.58161 12.59199
## [697] 12.60214 12.61205 12.62170 12.63107 12.64014 12.64891 12.65735 12.66546
## [705] 12.67320 12.68057 12.68755 12.69401 12.69983 12.70509 12.70983 12.71410
## [713] 12.71796 12.72145 12.72463 12.72756 12.73027 12.73283 12.73529 12.73770
## [721] 12.74011 12.74257 12.74514 12.74786 12.75080 12.75400 12.75751 12.76138
## [729] 12.76544 12.76946 12.77343 12.77735 12.78120 12.78499 12.78869 12.79230
## [737] 12.79582 12.79923 12.80252 12.80570 12.80875 12.81166 12.81442 12.81703
## [745] 12.81948 12.82175 12.82385 12.82576 12.82748 12.82899 12.83029 12.83142
## [753] 12.83242 12.83329 12.83403 12.83463 12.83510 12.83544 12.83563 12.83569
## [761] 12.83560 12.83537 12.83499 12.83446 12.83378 12.83295 12.83197 12.83083
## [769] 12.82953 12.82808 12.82646 12.82468 12.82273 12.82063 12.81838 12.81596
## [777] 12.81339 12.81068 12.80781 12.80479 12.80163 12.79832 12.79486 12.79127
## [785] 12.78753 12.78366 12.77965 12.77551 12.77123 12.76682 12.76228 12.75761
## [793] 12.75282 12.74790 12.74286 12.73769 12.73241 12.72701 12.72148 12.71582
## [801] 12.71003 12.70411 12.69805 12.69186 12.68553 12.67906 12.67246 12.66572
## [809] 12.65885 12.65184 12.64469 12.63740 12.62997 12.62240 12.61469 12.60683
## [817] 12.59884 12.59071 12.58243 12.57401 12.56544
#assign fits to a vector
both_trenda <- fit_botha
#extract y min and max for each
limits_botha <- ggplot_build(extract_botha)$data
## `geom_smooth()` using formula 'y ~ x'
limits_botha <- as.data.frame(limits_botha)
both_ymina <- limits_botha$ymin
both_ymaxa <- limits_botha$ymax
#reassign dataframes (just to be safe)
work_botha <- wrfa_both
#fill in missing dates to smooth fits
work_botha <- work_botha %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_botha <- work_botha$date
#create a new smooth dataframe to layer
smooth_frame_botha <- data.frame(date_vec_botha, both_trenda, both_ymina, both_ymaxa)
#WRF A
#plot smooth frames
p_wrf_a <- plotly::plot_ly() %>%
plotly::add_lines(x = ~date_vec_botha, y = ~both_trenda,
data = smooth_frame_botha,
hoverinfo = "text",
text = ~paste('</br> Date: ', date_vec_botha,
'</br> Median Log Copies: ', round(both_trenda, digits = 2)),
line = list(color = '#1B9E77', size = 8, opacity = 0.65),
showlegend = FALSE) %>%
layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_botha, ymin = ~both_ymina, ymax = ~both_ymaxa,
showlegend = FALSE,
opacity = 0.25,
hoverinfo = "text",
text = ~paste('</br> Date: ', date_vec_botha, #leaving in case we want to change
'</br> Max Log Copies: ', round(both_ymaxa, digits = 2),
'</br> Min Log Copies: ', round(both_ymina, digits = 2)),
name = "",
fillcolor = '#1B9E77',
line = list(color = '#1B9E77')) %>%
layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies",
showline = TRUE,
automargin = TRUE)) %>%
layout(xaxis = list(title = "Date")) %>%
layout(title = "WRF A") %>%
plotly::add_markers(x = ~date, y = ~log_total_copies_both,
data = wrfa_both,
hoverinfo = "text",
showlegend = FALSE,
text = ~paste('</br> Date: ', date,
'</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
marker = list(color = '#1B9E77', size = 6, opacity = 0.65))
p_wrf_a
save(p_wrf_a, file = "./plotly_objs/p_wrf_a.rda")
#**************************************WRF B PLOT**********************************************
#add trendlines
#extract data from geom_smooth
#both extract
# *********************************span 0.6***********************************
#*****************Must always update the n = TOTAL NUMBER OF DAYS*************************
extract_bothb <- ggplot(wrfb_both, aes(x = date, y = log_total_copies_both)) +
stat_smooth(aes(outfit=fit_bothb<<-..y..), method = "loess", color = '#D95F02',
span = 0.25, n = 821)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_bothb
## `geom_smooth()` using formula 'y ~ x'
fit_bothb
## [1] 12.61045 12.60638 12.60238 12.59847 12.59464 12.59088 12.58721 12.58361
## [9] 12.58009 12.57665 12.57329 12.57000 12.56680 12.56368 12.56063 12.55766
## [17] 12.55477 12.55196 12.54922 12.54657 12.54399 12.54149 12.53907 12.53673
## [25] 12.53446 12.53228 12.53017 12.52813 12.52618 12.52430 12.52250 12.52078
## [33] 12.51914 12.51757 12.51608 12.51467 12.51334 12.51208 12.51090 12.50979
## [41] 12.50877 12.50782 12.50695 12.50616 12.50547 12.50489 12.50440 12.50400
## [49] 12.50370 12.50350 12.50339 12.50338 12.50346 12.50363 12.50390 12.50426
## [57] 12.50470 12.50524 12.50587 12.50659 12.50739 12.50828 12.50926 12.51033
## [65] 12.51148 12.51272 12.51404 12.51544 12.51693 12.51850 12.52016 12.52189
## [73] 12.52371 12.52560 12.52757 12.52963 12.53176 12.53397 12.53625 12.53861
## [81] 12.54105 12.54356 12.54614 12.54880 12.55153 12.55434 12.55721 12.56016
## [89] 12.56317 12.56626 12.56942 12.57264 12.57606 12.57978 12.58380 12.58811
## [97] 12.59268 12.59751 12.60258 12.60788 12.61339 12.61910 12.62500 12.63107
## [105] 12.63730 12.64368 12.65019 12.65682 12.66355 12.67037 12.67727 12.68424
## [113] 12.69126 12.69831 12.70538 12.71247 12.71955 12.72661 12.73365 12.74063
## [121] 12.74756 12.75441 12.76118 12.76785 12.77441 12.78084 12.78712 12.79326
## [129] 12.79922 12.80501 12.81059 12.81597 12.82113 12.82674 12.83342 12.84105
## [137] 12.84952 12.85870 12.86848 12.87875 12.88938 12.90026 12.91128 12.92231
## [145] 12.93325 12.94397 12.95436 12.96429 12.97367 12.98236 12.99025 12.99722
## [153] 13.00317 13.00796 13.01314 13.02020 13.02899 13.03935 13.05113 13.06416
## [161] 13.07830 13.09338 13.10924 13.12574 13.14272 13.16001 13.17746 13.19491
## [169] 13.21221 13.22920 13.24573 13.26163 13.27675 13.29094 13.30403 13.31587
## [177] 13.32630 13.33517 13.34232 13.34760 13.35083 13.35188 13.35109 13.34896
## [185] 13.34557 13.34098 13.33526 13.32849 13.32073 13.31206 13.30254 13.29224
## [193] 13.28123 13.26959 13.25737 13.24466 13.23152 13.21802 13.20424 13.19023
## [201] 13.17607 13.16184 13.14759 13.13341 13.11935 13.10549 13.09190 13.07865
## [209] 13.06581 13.05345 13.03980 13.02322 13.00398 12.98236 12.95861 12.93301
## [217] 12.90583 12.87732 12.84777 12.81743 12.78658 12.75548 12.72440 12.69361
## [225] 12.66337 12.63396 12.60564 12.57868 12.55334 12.52990 12.50863 12.48978
## [233] 12.47363 12.45848 12.44251 12.42583 12.40854 12.39075 12.37254 12.35403
## [241] 12.33532 12.31650 12.29768 12.27896 12.26044 12.24223 12.22442 12.20711
## [249] 12.19042 12.17443 12.15925 12.14499 12.13173 12.11960 12.10891 12.09987
## [257] 12.09234 12.08622 12.08137 12.07767 12.07501 12.07326 12.07231 12.07203
## [265] 12.07229 12.07299 12.07399 12.07518 12.07643 12.07763 12.07865 12.07937
## [273] 12.07968 12.07944 12.07854 12.07686 12.07428 12.07067 12.06591 12.05988
## [281] 12.05386 12.04910 12.04547 12.04284 12.04107 12.04002 12.03957 12.03959
## [289] 12.03993 12.04047 12.04106 12.04159 12.04191 12.04188 12.04139 12.04029
## [297] 12.03845 12.03573 12.03201 12.02715 12.02101 12.01328 12.00384 11.99285
## [305] 11.98048 11.96690 11.95227 11.93675 11.92052 11.90374 11.88657 11.86918
## [313] 11.85173 11.83440 11.81734 11.80073 11.78472 11.76949 11.75519 11.74201
## [321] 11.73009 11.71961 11.71074 11.70363 11.69614 11.68620 11.67412 11.66018
## [329] 11.64468 11.62791 11.61018 11.59176 11.57297 11.55409 11.53541 11.51724
## [337] 11.49986 11.48358 11.46868 11.45546 11.44422 11.43525 11.42884 11.42529
## [345] 11.42490 11.42695 11.43048 11.43542 11.44169 11.44920 11.45787 11.46763
## [353] 11.47840 11.49009 11.50262 11.51592 11.52991 11.54450 11.55961 11.57517
## [361] 11.59110 11.60731 11.62372 11.64026 11.65684 11.67339 11.68983 11.70606
## [369] 11.72203 11.73764 11.75281 11.76747 11.78365 11.80325 11.82592 11.85134
## [377] 11.87918 11.90911 11.94079 11.97391 12.00812 12.04310 12.07852 12.11404
## [385] 12.14935 12.18411 12.21798 12.25065 12.28177 12.31102 12.33808 12.36260
## [393] 12.38426 12.40274 12.42025 12.43915 12.45928 12.48051 12.50268 12.52563
## [401] 12.54923 12.57332 12.59776 12.62239 12.64707 12.67165 12.69597 12.71990
## [409] 12.74327 12.76595 12.78778 12.80861 12.82830 12.84670 12.86365 12.87902
## [417] 12.89264 12.90437 12.91406 12.92157 12.92716 12.93128 12.93403 12.93549
## [425] 12.93578 12.93500 12.93323 12.93058 12.92716 12.92305 12.91836 12.91318
## [433] 12.90762 12.90178 12.89575 12.88964 12.88353 12.87754 12.87176 12.86629
## [441] 12.86123 12.85470 12.84495 12.83229 12.81701 12.79940 12.77977 12.75840
## [449] 12.73561 12.71167 12.68690 12.66159 12.63603 12.61052 12.58536 12.56085
## [457] 12.53728 12.51495 12.49415 12.47519 12.45836 12.44396 12.43228 12.42362
## [465] 12.41544 12.40517 12.39306 12.37934 12.36427 12.34810 12.33107 12.31342
## [473] 12.29540 12.27727 12.25925 12.24161 12.22459 12.20843 12.19338 12.17969
## [481] 12.16760 12.15736 12.14922 12.14341 12.14020 12.13880 12.13826 12.13853
## [489] 12.13956 12.14133 12.14377 12.14685 12.15053 12.15476 12.15951 12.16471
## [497] 12.17035 12.17636 12.18271 12.18936 12.19625 12.20336 12.21063 12.21802
## [505] 12.22550 12.23300 12.24051 12.24796 12.25532 12.26254 12.26959 12.27853
## [513] 12.29125 12.30739 12.32657 12.34846 12.37267 12.39886 12.42666 12.45572
## [521] 12.48567 12.51615 12.54681 12.57729 12.60722 12.63624 12.66400 12.69013
## [529] 12.71428 12.73609 12.75518 12.77122 12.78383 12.79266 12.79972 12.80726
## [537] 12.81520 12.82349 12.83206 12.84085 12.84981 12.85886 12.86796 12.87704
## [545] 12.88604 12.89489 12.90354 12.91193 12.91999 12.92767 12.93490 12.94163
## [553] 12.94778 12.95331 12.95814 12.96222 12.96550 12.96790 12.96936 12.96983
## [561] 12.96925 12.96754 12.96467 12.96055 12.95513 12.94835 12.94016 12.92923
## [569] 12.91455 12.89649 12.87541 12.85167 12.82564 12.79769 12.76817 12.73746
## [577] 12.70592 12.67392 12.64181 12.60997 12.57876 12.54854 12.51968 12.49254
## [585] 12.46750 12.44491 12.42513 12.40855 12.39188 12.37184 12.34880 12.32308
## [593] 12.29505 12.26504 12.23341 12.20049 12.16665 12.13223 12.09757 12.06302
## [601] 12.02893 11.99564 11.96351 11.93288 11.90410 11.87752 11.85347 11.83232
## [609] 11.81441 11.80008 11.78738 11.77418 11.76059 11.74672 11.73266 11.71851
## [617] 11.70438 11.69038 11.67660 11.66315 11.65012 11.63763 11.62577 11.61465
## [625] 11.60437 11.59503 11.58674 11.57959 11.57370 11.56916 11.56607 11.56454
## [633] 11.56502 11.56779 11.57271 11.57962 11.58839 11.59886 11.61088 11.62431
## [641] 11.63900 11.65480 11.67157 11.68916 11.70741 11.72619 11.74535 11.76473
## [649] 11.78420 11.80360 11.82278 11.84161 11.85992 11.87758 11.89443 11.91033
## [657] 11.92514 11.93870 11.95271 11.96886 11.98694 12.00676 12.02813 12.05086
## [665] 12.07475 12.09960 12.12522 12.15143 12.17802 12.20479 12.23157 12.25815
## [673] 12.28433 12.30994 12.33476 12.35861 12.38129 12.40261 12.42238 12.44040
## [681] 12.45647 12.47161 12.48692 12.50237 12.51794 12.53360 12.54932 12.56507
## [689] 12.58082 12.59654 12.61220 12.62777 12.64323 12.65854 12.67368 12.68862
## [697] 12.70332 12.71777 12.73192 12.74575 12.75924 12.77235 12.78505 12.79732
## [705] 12.80912 12.82043 12.83122 12.84147 12.85121 12.86048 12.86931 12.87773
## [713] 12.88578 12.89350 12.90092 12.90806 12.91498 12.92169 12.92824 12.93466
## [721] 12.94098 12.94724 12.95347 12.95971 12.96599 12.97235 12.97882 12.98543
## [729] 12.99224 12.99928 13.00650 13.01384 13.02128 13.02877 13.03625 13.04370
## [737] 13.05106 13.05830 13.06536 13.07221 13.07880 13.08509 13.09103 13.09659
## [745] 13.10171 13.10636 13.11049 13.11406 13.11702 13.11934 13.12096 13.12216
## [753] 13.12322 13.12415 13.12491 13.12550 13.12590 13.12609 13.12606 13.12580
## [761] 13.12529 13.12452 13.12346 13.12212 13.12046 13.11848 13.11616 13.11349
## [769] 13.11045 13.10703 13.10321 13.09898 13.09440 13.08958 13.08450 13.07916
## [777] 13.07355 13.06769 13.06156 13.05516 13.04849 13.04154 13.03433 13.02683
## [785] 13.01906 13.01100 13.00266 12.99403 12.98511 12.97590 12.96640 12.95660
## [793] 12.94651 12.93611 12.92541 12.91441 12.90310 12.89148 12.87954 12.86725
## [801] 12.85464 12.84169 12.82842 12.81482 12.80090 12.78666 12.77210 12.75724
## [809] 12.74206 12.72658 12.71079 12.69470 12.67832 12.66164 12.64467 12.62742
## [817] 12.60987 12.59205 12.57394 12.55556 12.53691
#assign fits to a vector
both_trendb <- fit_bothb
#extract y min and max for each
limits_bothb <- ggplot_build(extract_bothb)$data
## `geom_smooth()` using formula 'y ~ x'
limits_bothb <- as.data.frame(limits_bothb)
both_yminb <- limits_bothb$ymin
both_ymaxb <- limits_bothb$ymax
#reassign dataframes (just to be safe)
work_bothb <- wrfb_both
#fill in missing dates to smooth fits
work_bothb <- work_bothb %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_bothb <- work_bothb$date
#create a new smooth dataframe to layer
smooth_frame_bothb <- data.frame(date_vec_bothb, both_trendb, both_yminb, both_ymaxb)
#WRF B
#plot smooth frames
p_wrf_b <- plotly::plot_ly() %>%
plotly::add_lines(x = ~date_vec_bothb, y = ~both_trendb,
data = smooth_frame_bothb,
hoverinfo = "text",
text = ~paste('</br> Date: ', date_vec_bothb,
'</br> Median Log Copies: ', round(both_trendb, digits = 2)),
line = list(color = '#D95F02', size = 8, opacity = 0.65),
showlegend = FALSE) %>%
layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_bothb, ymin = ~both_yminb, ymax = ~both_ymaxb,
showlegend = FALSE,
opacity = 0.25,
hoverinfo = "text",
text = ~paste('</br> Date: ', date_vec_bothb, #leaving in case we want to change
'</br> Max Log Copies: ', round(both_ymaxb, digits = 2),
'</br> Min Log Copies: ', round(both_yminb, digits = 2)),
name = "",
fillcolor = '#D95F02',
line = list(color = '#D95F02')) %>%
layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies",
showline = TRUE,
automargin = TRUE)) %>%
layout(xaxis = list(title = "Date")) %>%
layout(title = "WRF B") %>%
plotly::add_markers(x = ~date, y = ~log_total_copies_both,
data = wrfb_both,
hoverinfo = "text",
showlegend = FALSE,
text = ~paste('</br> Date: ', date,
'</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
marker = list(color = '#D95F02', size = 6, opacity = 0.65))
p_wrf_b
save(p_wrf_b, file = "./plotly_objs/p_wrf_b.rda")
#**************************************WRF C PLOT********************************************** #add trendlines #extract data from geom_smooth # *********************************span 0.6*********************************** #*****************Must always update the n = TOTAL NUMBER OF DAYS*************************
extract_bothc <- ggplot(wrfc_both, aes(x = date, y = log_total_copies_both)) +
stat_smooth(aes(outfit=fit_bothc<<-..y..), method = "loess", color = '#E7298A',
span = 0.25, n = 821)
## Warning: Ignoring unknown aesthetics: outfit
#look at the fits to align dates and total observations
#both
extract_bothc
## `geom_smooth()` using formula 'y ~ x'
fit_bothc
## [1] 12.05732 12.05046 12.04370 12.03704 12.03048 12.02402 12.01765 12.01138
## [9] 12.00522 11.99914 11.99316 11.98728 11.98150 11.97580 11.97020 11.96469
## [17] 11.95928 11.95395 11.94872 11.94358 11.93852 11.93356 11.92868 11.92390
## [25] 11.91919 11.91458 11.91005 11.90561 11.90125 11.89698 11.89279 11.88868
## [33] 11.88465 11.88071 11.87685 11.87307 11.86937 11.86574 11.86220 11.85873
## [41] 11.85534 11.85203 11.84880 11.84564 11.84255 11.83954 11.83661 11.83374
## [49] 11.83095 11.82823 11.82561 11.82308 11.82067 11.81836 11.81616 11.81407
## [57] 11.81209 11.81021 11.80844 11.80678 11.80522 11.80377 11.80243 11.80120
## [65] 11.80007 11.79905 11.79813 11.79732 11.79662 11.79602 11.79554 11.79515
## [73] 11.79488 11.79471 11.79464 11.79468 11.79483 11.79509 11.79545 11.79591
## [81] 11.79648 11.79716 11.79794 11.79883 11.79982 11.80092 11.80213 11.80344
## [89] 11.80485 11.80637 11.80800 11.80973 11.81156 11.81350 11.81553 11.81767
## [97] 11.81992 11.82227 11.82474 11.82731 11.82999 11.83279 11.83571 11.83874
## [105] 11.84189 11.84516 11.84855 11.85207 11.85571 11.85948 11.86337 11.86740
## [113] 11.87155 11.87584 11.88026 11.88482 11.88952 11.89436 11.89934 11.90446
## [121] 11.90972 11.91514 11.92069 11.92640 11.93226 11.93827 11.94443 11.95075
## [129] 11.95723 11.96386 11.97066 11.97762 11.98474 11.99323 12.00416 12.01727
## [137] 12.03233 12.04910 12.06733 12.08679 12.10724 12.12843 12.15012 12.17208
## [145] 12.19406 12.21583 12.23714 12.25775 12.27742 12.29591 12.31298 12.32840
## [153] 12.34191 12.35329 12.36486 12.37901 12.39552 12.41417 12.43476 12.45706
## [161] 12.48086 12.50595 12.53213 12.55917 12.58685 12.61498 12.64333 12.67170
## [169] 12.69986 12.72760 12.75472 12.78100 12.80622 12.83017 12.85265 12.87342
## [177] 12.89229 12.90904 12.92345 12.93532 12.94443 12.95056 12.95432 12.95650
## [185] 12.95719 12.95646 12.95439 12.95106 12.94655 12.94093 12.93429 12.92669
## [193] 12.91823 12.90897 12.89900 12.88840 12.87723 12.86559 12.85354 12.84118
## [201] 12.82857 12.81579 12.80292 12.79005 12.77724 12.76458 12.75214 12.74001
## [209] 12.72826 12.71696 12.70424 12.68833 12.66952 12.64809 12.62433 12.59851
## [217] 12.57093 12.54187 12.51160 12.48042 12.44860 12.41644 12.38421 12.35219
## [225] 12.32068 12.28995 12.26029 12.23198 12.20531 12.18055 12.15800 12.13793
## [233] 12.12064 12.10430 12.08699 12.06883 12.04992 12.03036 12.01026 11.98974
## [241] 11.96890 11.94784 11.92668 11.90551 11.88446 11.86362 11.84311 11.82302
## [249] 11.80348 11.78458 11.76644 11.74916 11.73284 11.71761 11.70334 11.68985
## [257] 11.67707 11.66496 11.65347 11.64255 11.63215 11.62223 11.61273 11.60360
## [265] 11.59481 11.58629 11.57800 11.56988 11.56190 11.55400 11.54614 11.53826
## [273] 11.53031 11.52225 11.51403 11.50560 11.49690 11.48790 11.47854 11.46877
## [281] 11.45934 11.45097 11.44356 11.43702 11.43126 11.42618 11.42170 11.41772
## [289] 11.41414 11.41088 11.40784 11.40493 11.40206 11.39913 11.39605 11.39272
## [297] 11.38907 11.38498 11.38038 11.37516 11.36924 11.36228 11.35410 11.34483
## [305] 11.33461 11.32355 11.31179 11.29947 11.28671 11.27364 11.26039 11.24709
## [313] 11.23388 11.22087 11.20822 11.19603 11.18445 11.17360 11.16361 11.15462
## [321] 11.14675 11.14014 11.13491 11.13120 11.12734 11.12172 11.11457 11.10611
## [329] 11.09657 11.08617 11.07513 11.06368 11.05204 11.04043 11.02907 11.01820
## [337] 11.00803 10.99879 10.99069 10.98397 10.97885 10.97555 10.97429 10.97529
## [345] 10.97879 10.98467 10.99260 11.00244 11.01407 11.02735 11.04217 11.05839
## [353] 11.07589 11.09452 11.11418 11.13472 11.15602 11.17796 11.20039 11.22320
## [361] 11.24626 11.26943 11.29259 11.31561 11.33836 11.36072 11.38255 11.40372
## [369] 11.42411 11.44360 11.46204 11.47931 11.49746 11.51843 11.54193 11.56768
## [377] 11.59540 11.62480 11.65559 11.68750 11.72024 11.75352 11.78707 11.82060
## [385] 11.85382 11.88645 11.91821 11.94881 11.97797 12.00541 12.03084 12.05398
## [393] 12.07454 12.09224 12.10869 12.12563 12.14299 12.16070 12.17868 12.19685
## [401] 12.21515 12.23351 12.25184 12.27009 12.28816 12.30600 12.32352 12.34066
## [409] 12.35734 12.37348 12.38903 12.40389 12.41800 12.43129 12.44368 12.45510
## [417] 12.46548 12.47474 12.48281 12.48962 12.49517 12.49957 12.50290 12.50524
## [425] 12.50667 12.50727 12.50712 12.50630 12.50488 12.50295 12.50059 12.49788
## [433] 12.49489 12.49170 12.48840 12.48507 12.48178 12.47861 12.47565 12.47297
## [441] 12.47065 12.46753 12.46248 12.45569 12.44730 12.43749 12.42643 12.41427
## [449] 12.40119 12.38735 12.37291 12.35805 12.34293 12.32771 12.31256 12.29765
## [457] 12.28313 12.26919 12.25597 12.24366 12.23241 12.22239 12.21376 12.20670
## [465] 12.19931 12.18975 12.17828 12.16512 12.15053 12.13474 12.11799 12.10052
## [473] 12.08258 12.06441 12.04625 12.02834 12.01092 11.99424 11.97852 11.96403
## [481] 11.95099 11.93965 11.93025 11.92303 11.91824 11.91487 11.91178 11.90896
## [489] 11.90643 11.90418 11.90222 11.90056 11.89919 11.89813 11.89738 11.89694
## [497] 11.89681 11.89700 11.89751 11.89836 11.89953 11.90104 11.90289 11.90508
## [505] 11.90762 11.91052 11.91377 11.91738 11.92135 11.92570 11.93042 11.93678
## [513] 11.94588 11.95747 11.97129 11.98708 12.00457 12.02352 12.04367 12.06475
## [521] 12.08651 12.10870 12.13104 12.15330 12.17520 12.19649 12.21692 12.23622
## [529] 12.25413 12.27041 12.28478 12.29700 12.30681 12.31394 12.31996 12.32657
## [537] 12.33371 12.34133 12.34937 12.35778 12.36651 12.37549 12.38468 12.39401
## [545] 12.40344 12.41291 12.42237 12.43175 12.44101 12.45009 12.45894 12.46750
## [553] 12.47571 12.48352 12.49088 12.49773 12.50402 12.50969 12.51469 12.51896
## [561] 12.52244 12.52509 12.52685 12.52766 12.52747 12.52622 12.52386 12.51989
## [569] 12.51396 12.50626 12.49698 12.48628 12.47435 12.46138 12.44754 12.43301
## [577] 12.41799 12.40264 12.38715 12.37170 12.35647 12.34165 12.32741 12.31394
## [585] 12.30142 12.29003 12.27994 12.27135 12.26204 12.24986 12.23511 12.21806
## [593] 12.19900 12.17821 12.15598 12.13258 12.10832 12.08346 12.05830 12.03311
## [601] 12.00818 11.98380 11.96025 11.93782 11.91678 11.89742 11.88002 11.86488
## [609] 11.85227 11.84248 11.83392 11.82487 11.81542 11.80565 11.79564 11.78547
## [617] 11.77524 11.76502 11.75489 11.74494 11.73526 11.72592 11.71701 11.70861
## [625] 11.70081 11.69369 11.68733 11.68181 11.67722 11.67365 11.67117 11.66987
## [633] 11.67015 11.67226 11.67609 11.68150 11.68837 11.69658 11.70599 11.71649
## [641] 11.72795 11.74023 11.75323 11.76680 11.78083 11.79518 11.80974 11.82437
## [649] 11.83896 11.85337 11.86748 11.88116 11.89430 11.90675 11.91840 11.92912
## [657] 11.93879 11.94728 11.95576 11.96543 11.97618 11.98789 12.00044 12.01372
## [665] 12.02762 12.04202 12.05682 12.07189 12.08712 12.10239 12.11760 12.13263
## [673] 12.14737 12.16170 12.17550 12.18867 12.20108 12.21263 12.22321 12.23269
## [681] 12.24096 12.24857 12.25612 12.26361 12.27104 12.27839 12.28567 12.29287
## [689] 12.29999 12.30701 12.31394 12.32077 12.32750 12.33411 12.34061 12.34698
## [697] 12.35323 12.35935 12.36534 12.37118 12.37688 12.38242 12.38781 12.39304
## [705] 12.39810 12.40299 12.40770 12.41191 12.41535 12.41809 12.42020 12.42175
## [713] 12.42281 12.42347 12.42378 12.42383 12.42369 12.42342 12.42311 12.42281
## [721] 12.42262 12.42259 12.42280 12.42333 12.42424 12.42561 12.42751 12.43001
## [729] 12.43296 12.43611 12.43945 12.44294 12.44656 12.45028 12.45407 12.45792
## [737] 12.46178 12.46563 12.46945 12.47321 12.47688 12.48043 12.48383 12.48707
## [745] 12.49011 12.49292 12.49548 12.49777 12.49974 12.50138 12.50266 12.50374
## [753] 12.50478 12.50578 12.50673 12.50764 12.50849 12.50927 12.50999 12.51063
## [761] 12.51120 12.51167 12.51206 12.51235 12.51253 12.51261 12.51257 12.51241
## [769] 12.51213 12.51171 12.51116 12.51046 12.50965 12.50876 12.50780 12.50676
## [777] 12.50563 12.50443 12.50314 12.50177 12.50031 12.49876 12.49713 12.49541
## [785] 12.49359 12.49168 12.48968 12.48759 12.48539 12.48310 12.48071 12.47822
## [793] 12.47563 12.47293 12.47013 12.46722 12.46420 12.46108 12.45784 12.45446
## [801] 12.45096 12.44734 12.44359 12.43972 12.43573 12.43162 12.42740 12.42306
## [809] 12.41862 12.41406 12.40939 12.40462 12.39974 12.39476 12.38968 12.38450
## [817] 12.37922 12.37385 12.36839 12.36283 12.35719
#assign fits to a vector
both_trendc <- fit_bothc
#extract y min and max for each
limits_bothc <- ggplot_build(extract_bothc)$data
## `geom_smooth()` using formula 'y ~ x'
limits_bothc <- as.data.frame(limits_bothc)
both_yminc <- limits_bothc$ymin
both_ymaxc <- limits_bothc$ymax
#reassign dataframes (just to be safe)
work_bothc <- wrfc_both
#fill in missing dates to smooth fits
work_bothc <- work_bothc %>% complete(date = seq(min(date), max(date), by = "1 day"))
date_vec_bothc <- work_bothc$date
#create a new smooth dataframe to layer
smooth_frame_bothc <- data.frame(date_vec_bothc, both_trendc, both_yminc, both_ymaxc)
#WRF C
#plot smooth frames
p_wrf_c <- plotly::plot_ly() %>%
plotly::add_lines(x = ~date_vec_bothc, y = ~both_trendc,
data = smooth_frame_bothc,
hoverinfo = "text",
text = ~paste('</br> Date: ', date_vec_bothc,
'</br> Median Log Copies: ', round(both_trendc, digits = 2)),
line = list(color = '#E7298A', size = 8, opacity = 0.65),
showlegend = FALSE) %>%
layout(xaxis = list(range = c(mindate - 7, maxdate + 7))) %>% #buffer here
plotly::add_ribbons(x ~date_vec_bothc, ymin = ~both_yminc, ymax = ~both_ymaxc,
showlegend = FALSE,
opacity = 0.25,
hoverinfo = "text",
text = ~paste('</br> Date: ', date_vec_bothc, #leaving in case we want to change
'</br> Max Log Copies: ', round(both_ymaxc, digits = 2),
'</br> Min Log Copies: ', round(both_yminc, digits = 2)),
name = "",
fillcolor = '#E7298A',
line = list(color = '#E7298A')) %>%
layout(yaxis = list(title = "Total Log10 SARS CoV-2 Copies",
showline = TRUE,
automargin = TRUE)) %>%
layout(xaxis = list(title = "Date")) %>%
layout(title = "WRF C") %>%
plotly::add_markers(x = ~date, y = ~log_total_copies_both,
data = wrfc_both,
hoverinfo = "text",
showlegend = FALSE,
text = ~paste('</br> Date: ', date,
'</br> Actual Log Copies: ', round(log_total_copies_both, digits = 2)),
marker = list(color = '#E7298A', size = 6, opacity = 0.65))
p_wrf_c
save(p_wrf_c, file = "./plotly_objs/p_wrf_c.rda")
save(wrfa_both, file = "./plotly_objs/wrfa_both.rda")
save(wrfb_both, file = "./plotly_objs/wrfb_both.rda")
save(wrfc_both, file = "./plotly_objs/wrfc_both.rda")
save(date_vec_botha, file = "./plotly_objs/date_vec_botha.rda")
save(date_vec_bothb, file = "./plotly_objs/date_vec_bothb.rda")
save(date_vec_bothc, file = "./plotly_objs/date_vec_bothc.rda")
save(both_ymina, file = "./plotly_objs/both_ymina.rda")
save(both_ymaxa, file = "./plotly_objs/both_ymaxa.rda")
save(both_yminb, file = "./plotly_objs/both_yminb.rda")
save(both_ymaxb, file = "./plotly_objs/both_ymaxb.rda")
save(both_yminc, file = "./plotly_objs/both_yminc.rda")
save(both_ymaxc, file = "./plotly_objs/both_ymaxc.rda")